<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="com.hertz.appr.service.ActionService"%>
<%@page import="com.hertz.appr.pojo.db.Action"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="net.sf.json.JSONArray"%>
<%@page import="org.springframework.web.util.HtmlUtils"%>
<%@page import="com.hertz.appr.dao.IBaseDao"%>
<%@page import="com.hertz.appr.dao.DaoPage"%>
<%@page import="net.sf.json.JSONObject"%>
<%String callback = request.getParameter("callback");
String no = request.getParameter("no");
if(StringUtils.isBlank(no) || !StringUtils.isNumeric(no)){
	no = "10";
}
Integer num = Integer.valueOf(no);

String pageNum = request.getParameter("p");
if(StringUtils.isBlank(pageNum) || !StringUtils.isNumeric(pageNum)){
	pageNum = "0";
}
Integer p = Integer.valueOf(pageNum);

String msg = "();";
ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletConfig().getServletContext());
ActionService actionService = (ActionService)ctx.getBean("actionService");
IBaseDao<Action, Long> actionDao = (IBaseDao<Action,Long>)ctx.getBean("actionDao");
String countHql = "select count(id) from Action ";
String hql = "from Action order by id desc";

DaoPage<Action> daoPage = actionDao.pagedQuery(countHql,hql,p.longValue(),num,null);
if(daoPage != null){
	JSONObject jo = JSONObject.fromObject(daoPage);
	msg = jo.toString();
	msg = "(" + msg + ")";
}


msg = callback + msg;
%>
<%=msg %>


